﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Stats.Objects
{
    /// <summary>
    /// A PendingFeedback objects is an object passed from Stats to Groupware that represents a pendingFeedback and contains a description
    /// about the trip wich is related and infos about the feedback that had to be left.
    /// </summary>
    public class FeedbackRequest
    {
        /// <summary>
        /// The ID of the user who has to leave the feedback
        /// </summary>
        public int SenderID { get; set; }

        /// <summary>
        /// The username of the user who has to leave the feedback
        /// </summary>
        public string SenderUsername { get; set; }

        /// <summary>
        /// The feedback receiver user ID
        /// </summary>
        public int ReceiverID { get; set; }

        /// <summary>
        /// The feedback receiver username
        /// </summary>
        public string ReceiverUsername { get; set; }

        /// <summary>
        /// The feedback type:
        /// TYPE = 0 --> FEEDBACK TO LEAVE FROM DRIVER TO PASSENGER
        /// TYPE = 1 --> FEEDBACK TO LEAVE FROM PASSENGER TO DRIVER
        /// </summary>
        public int FeedbackType { get; set; }

        /// <summary>
        /// The departure date of trip the pending feedback is related
        /// </summary>
        public DateTime TripDepartureDate { get; set; }

        /// <summary>
        /// The start city of trip the pending feedback is related
        /// </summary>
        public string TripStartCity { get; set; }

        /// <summary>
        /// The destination city of trip the pending feedback is related
        /// </summary>
        public string TripDestinationCity { get; set; }

        /// <summary>
        /// The ID of trip the pending feedback is related
        /// </summary>
        public int TripID { get; set; }

        /// <summary>
        /// The constructor for the FeedbackRequest object.
        /// </summary>
        /// <param name="sender_id">The ID of the user who has to leave the feedback</param>
        /// <param name="receiver_id">The feedback receiver user ID</param>
        /// <param name="feedback_type">The feedback type: TYPE = 0 --> FEEDBACK FROM DRIVER TO PASSENGER TYPE = 1 --> FEEDBACK FROM PASSENGER TO DRIVER</param>
        /// <param name="tripDeparture_date">The departure date of trip the pending feedback is related</param>
        /// <param name="startCity">The start city of trip the pending feedback is related</param>
        /// <param name="destCity">The destination city of trip the pending feedback is related</param>
        /// <param name="trip_id">The ID of trip the pending feedback is related</param>
        /// <example>
        /// <code>
        /// FeedbackRequest fdb = new FeedbackRequest(432,303,1,"16/05/2008","Pisa","Roma",670);
        /// </code>
        /// </example>
        public FeedbackRequest(int sender_id, int receiver_id, int feedback_type, DateTime tripDeparture_date, string startCity, string destCity, int trip_id)
        {
            SenderID = sender_id;
            SenderUsername = AuxUserMethods.getUserUsername(sender_id);
            ReceiverID = receiver_id;
            ReceiverUsername = AuxUserMethods.getUserUsername(receiver_id);
            FeedbackType = feedback_type;
            TripDepartureDate = tripDeparture_date;
            TripStartCity = startCity;
            TripDestinationCity = destCity;
            TripID = trip_id;
        }
    }
}
